﻿//-----------------------------------------------------------------------
// <copyright file="ProjectFile.cs">
//     Copyright (c) Nicole Calinoiu. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;

using Microsoft.FxCop.Common;

namespace Bordecal.FxCop.Sdk.Testing
{
	/// <summary>
	/// Helper class used to read an FxCop project file.
	/// </summary>
	internal sealed class ProjectFile
	{
		private readonly IEnumerable<string> _targetPaths;

		public ProjectFile(string projectPath)
		{
			dynamic project = Activator.CreateInstance(typeof(FxCopCategoryInfo).Assembly.GetType("Microsoft.FxCop.Common.Project"));
			project.Load(projectPath);

			this._targetPaths = project.Targets.Keys.ToList();
		}

		internal IEnumerable<string> TargetPaths
		{
			get
			{
				return this._targetPaths;
			}
		}
	}
}